import { defineStore } from 'pinia'
import { Ref, ref } from "vue";
export const useStore = defineStore('cacheView', () => {
  // 缓存页面
  const cacheView: Ref<string[]> = ref([]);
  // 添加缓存
  const addCache = (name: string) => {
    if(!cacheView.value.includes(name)) {
      cacheView.value.push(name);
    }
  }
  // 删除缓存
  const delCache = (name: string) => {
    if(cacheView.value.includes(name)) {
      cacheView.value.splice(cacheView.value.findIndex(x => x === name),1);
    }
  }
  return {
    cacheView,
    addCache,
    delCache,
  }
})
